package cn.com.headfree.userinfo.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import cn.com.headfree.base.controller.ExBaseController;
import cn.com.headfree.entity.*;
import cn.com.headfree.util.CookieUtil;
import cn.com.headfree.util.GetFullDeptByErpNoUtil;
import cn.com.headfree.util.SaiUtil;
import cn.com.headfree.util.SysDictionaryUtil;
import cn.com.headfree.vo.complex.*;

import com.gta.edu.sdk.util.StringUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.gta.edu.sdk.common.dto.Page;
import cn.com.headfree.base.controller.ResultData;
import cn.com.headfree.depterprela.service.IDeptErpRelaService;
import cn.com.headfree.entity.isc.User;
import cn.com.headfree.userinfo.service.IUserInfoService;
import cn.com.headfree.vo.EachTypeDetailVo;
import cn.com.headfree.vo.FuturePostVo;
import cn.com.headfree.vo.SysDictionaryInfoVo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping(value = "/userinfo", produces = "application/json;charset=UTF-8")
public class UserInfoController extends ExBaseController {

	private static final Logger LOG = LogManager.getLogger(UserInfoController.class);
	@Autowired
	public IUserInfoService userInfoService;

	@Autowired
	private IDeptErpRelaService deptErpRelaService;
	/**
	 * 获取当前登录人详细信息
	 */
	@RequestMapping("/getCurrentUserInfo")
	@ResponseBody
	public ResultData getCurrentUserInfo(HttpServletRequest request){
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			rs.setData(user);
		}catch (Exception e){
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加人资基本信息
	 *
	 * @param baseInfo
	 * @return
	 */
	@RequestMapping("/addBaseInfo")
	@ResponseBody
	public ResultData addBaseInfo(HttpServletRequest request,TEmpBaseInfo baseInfo) {
		ResultData rs = new ResultData();
		// 由于有附件，主键id由前端生成
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			String message = userInfoService.addBaseInfo(baseInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else{
				rs.setData("人资基本信息添加成功！");
				LOG.info("人资基本信息添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("人资基本信息添加失败！");
			e.printStackTrace();
		}
		return rs;
	}


	@RequestMapping("/getBaseInfoByErpNo")
	@ResponseBody
	public ResultData getBaseInfoByErpNo(String erpNo){
		ResultData rs = new ResultData();
		try {
			TEmpBaseInfo tEmpBaseInfo=userInfoService.getBaseInfoByErpNo(erpNo);
			rs.setData(tEmpBaseInfo);
			LOG.info("人资基本信息查询成功！");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("人资基本信息查询失败！");
			e.printStackTrace();
		}
		return rs;
	}


	@RequestMapping("/getBaseInfoById")
	@ResponseBody
	public ResultData getBaseInfoById(String id){
		ResultData rs = new ResultData();
		try {
			TEmpBaseInfo tEmpBaseInfo=userInfoService.getBaseInfoById(id);
			rs.setData(tEmpBaseInfo);
			LOG.info("人资基本信息查询成功！");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("人资基本信息查询失败！");
			e.printStackTrace();
		}
		return rs;
	}


	/**
	 * 添加年度绩效
	 * @param yearEffectInfo
	 * @return
	 */
	@RequestMapping("/addYearEffect")
	@ResponseBody
	public ResultData addYearEffect(TYearEffectInfo yearEffectInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			yearEffectInfo.setToken(this.getToken(request));
			String message = userInfoService.addYearEffect(yearEffectInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else{
				rs.setData("年度绩效添加成功！");
				LOG.info("年度绩效添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("年度绩效添加失败！");
			e.printStackTrace();
		}
		return rs;
	}


	@RequestMapping("/getYearEffectByErpNo")
	@ResponseBody
	public ResultData getYearEffectByErpNo(String erpNo) {
		ResultData rs = new ResultData();
		try {
			List<TYearEffectInfo> yearEffectInfoList= userInfoService.getYearEffectByErpNo(erpNo);
			rs.setData(yearEffectInfoList);
			LOG.info("查找个人年度绩效成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找个人年度绩效失败！");
			e.printStackTrace();
		}
		return rs;
	}


	@RequestMapping("/getYearEffectById")
	@ResponseBody
	public ResultData getYearEffectById(String id) {
		ResultData rs = new ResultData();
		try {
			TYearEffectInfo yearEffectInfo= userInfoService.getYearEffectById(id);
			rs.setData(yearEffectInfo);
			LOG.info("查找个人年度绩效成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找个人年度绩效失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyYearEffectById")
    @ResponseBody
    public ResultData getReadyYearEffectById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TYearEffectInfo> yearEffectInfo = userInfoService.getReadyYearEffectById(id);
            if(yearEffectInfo.size()>0){
				rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
			}else{
				rs.setSuccess(true);
            }
            LOG.info("查找个人年度绩效成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找个人年度绩效失败！");
            e.printStackTrace();
        }
        return rs;
    }


	@RequestMapping("/getPageYearEffect")
	@ResponseBody
	public ResultData getPageYearEffect(Page<TYearEffectInfo> page,@RequestBody TYearEffectInfo tYearEffectInfo) {
		ResultData rs = new ResultData();
		rs = checkErpNoIsNull(tYearEffectInfo.getErpNo());
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageYearEffectByCondi(page,tYearEffectInfo);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setPerforGradeName(SysDictionaryUtil.getNameByValueForDefault("PerformLevelRecentThreeYears", p.getPerforGrade()));//绩效等级
				});
			}
			rs.setData(page);
			LOG.info("查找个人年度绩效成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找个人年度绩效失败！");
			e.printStackTrace();
		}
		return rs;
	}




	/**
	 * 添加学历信息、继续教育学历信息
	 *
	 * @param tEducateInfo
	 * @return
	 */
	@RequestMapping("/addEducateInfo")
	@ResponseBody
	public ResultData addEducateInfo(TEducateInfo tEducateInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tEducateInfo.setToken(this.getToken(request));
			String message = userInfoService.addEducateInfo(tEducateInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else{
				rs.setData("学历信息添加成功！");
				LOG.info("学历信息添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("学历信息添加失败！");
			e.printStackTrace();
		}
		return rs;
	}


	@RequestMapping("/getPageEducateInfo")
	@ResponseBody
	public ResultData getPageEducateInfo(Page<TEducateInfo> page,@RequestBody TEducateInfo tEducateInfo) {
		ResultData rs = new ResultData();
		rs = checkErpNoIsNull(tEducateInfo.getErpNo());
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageEducateInfoByCondi(page,tEducateInfo);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setSchoolTypeName(SysDictionaryUtil.getNameByValueForDefault("CollegeCategory", p.getSchoolType()));
					p.setEducNameName(SysDictionaryUtil.getNameByValueForDefault("PersonnelQualifications", p.getEducName()));
					p.setDegreeNameName(SysDictionaryUtil.getNameByValueForDefault("AcademicDegree", p.getDegreeName()));
				});
			}
			rs.setData(page);
			LOG.info("查找学历信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找学历信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

	@RequestMapping("/getEducateInfoById")
	@ResponseBody
	public ResultData getEducateInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			TEducateInfo tEducateInfo = userInfoService.getEducateInfoById(id);
			rs.setData(tEducateInfo);
			LOG.info("查找学历信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找学历信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyEducateInfoById")
    @ResponseBody
    public ResultData getReadyEducateInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TEducateInfo> tEducateInfo = userInfoService.getReadyEducateInfoById(id);
            if(tEducateInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找学历信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找学历信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


	/**
	 * 添加专业技术资格信息
	 *
	 * @param
	 * @return
	 */
	@RequestMapping("/addProTecInfo")
	@ResponseBody
	public ResultData addProTecInfo(TProTecInfo tProTecInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tProTecInfo.setToken(this.getToken(request));
			String message = userInfoService.addProTecInfo(tProTecInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else{
				rs.setData("专业技术资格信息添加成功！");
				LOG.info("专业技术资格信息添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("专业技术资格信息添加失败！");
			e.printStackTrace();
		}
		return rs;
	}

	@RequestMapping("/getProTecInfoById")
	@ResponseBody
	public ResultData getProTecInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			TProTecInfo tProTecInfo = userInfoService.getProTecInfoById(id);
			rs.setData(tProTecInfo);
			LOG.info("查找专业技术资格信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找专业技术资格信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyProTecInfoById")
    @ResponseBody
    public ResultData getReadyProTecInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TProTecInfo> tProTecInfo = userInfoService.getReadyProTecInfoById(id);
            if(tProTecInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找专业技术资格信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找专业技术资格信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


	@RequestMapping("/getPageProTecInfo")
	@ResponseBody
	public ResultData getPageProTecInfo(Page<TProTecInfo> page,@RequestBody TProTecInfo tProTecInfo) {
		ResultData rs = new ResultData();
		rs = checkErpNoIsNull(tProTecInfo.getErpNo());
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageProTecInfoByCondi(page,tProTecInfo);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setSubjSetName(SysDictionaryUtil.getNameByValueForDefault("ProTechnicalQualifications", p.getSubjSet()));
					p.setSubjLevelName(SysDictionaryUtil.getNameByValueForDefault("ProfessionalQualifications", p.getSubjLevel()));
					p.setOrgLevelName(SysDictionaryUtil.getNameByValueForDefault("IdentificationUnitLevel", p.getOrgLevel()));
				});
			}
			rs.setData(page);
			LOG.info("查找专业技术资格信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找专业技术资格信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加技能等级信息
	 *
	 * @param tSkillLevelInfo
	 * @return
	 */
	@RequestMapping("/addSkillLevelInfo")
	@ResponseBody
	public ResultData addSkillLevelInfo(TSkillLevelInfo tSkillLevelInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tSkillLevelInfo.setToken(this.getToken(request));
			String message = userInfoService.addSkillLevelInfo(tSkillLevelInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else{
				rs.setData("技能等级信息添加成功！");
				LOG.info("技能等级信息添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("技能等级信息添加失败！");
			e.printStackTrace();
		}
		return rs;
	}

	@RequestMapping("/getSkillLevelInfoById")
	@ResponseBody
	public ResultData getSkillLevelInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			TSkillLevelInfo tSkillLevelInfo = userInfoService.getSkillLevelInfoById(id);
			rs.setData(tSkillLevelInfo);
			LOG.info("查找技能等级信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找技能等级信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadySkillLevelInfoById")
    @ResponseBody
    public ResultData getReadySkillLevelInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TSkillLevelInfo> tSkillLevelInfo = userInfoService.getReadySkillLevelInfoById(id);
            if(tSkillLevelInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找技能等级信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找技能等级信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


	@RequestMapping("/getPageSkillLevelInfo")
	@ResponseBody
	public ResultData getPageSkillLevelInfo(Page<TSkillLevelInfo> page,@RequestBody TSkillLevelInfo tSkillLevelInfo) {
		ResultData rs = new ResultData();
		rs = checkErpNoIsNull(tSkillLevelInfo.getErpNo());
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageSkillLevelInfoByCondi(page,tSkillLevelInfo);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setTechTypeName(SysDictionaryUtil.getNameByValueForDefault("SkillAppraisalWork", p.getTechType()));
					p.setQualifiLevelName(SysDictionaryUtil.getNameByValueForDefault("QualificationLevel", p.getQualifiLevel()));
					p.setOrgLevelName(SysDictionaryUtil.getNameByValueForDefault("IdentificationUnitLevel", p.getOrgLevel()));
				});
			}
			rs.setData(page);
			LOG.info("查找技能等级信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找技能等级信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加专家人才称号信息
	 *
	 * @param tExpertTitleInfo
	 * @return
	 */
	@RequestMapping("/addExpertTitleInfo")
	@ResponseBody
	public ResultData addExpertTitleInfo(TExpertTitleInfo tExpertTitleInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tExpertTitleInfo.setToken(this.getToken(request));
			String message = userInfoService.addExpertTitleInfo(tExpertTitleInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else{
				rs.setData("专家人才称号信息添加成功！");
				LOG.info("专家人才称号信息添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("专家人才称号信息添加失败！");
			e.printStackTrace();
		}
		return rs;
	}

	@RequestMapping("/getExpertTitleInfoById")
	@ResponseBody
	public ResultData getExpertTitleInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			TExpertTitleInfo tExpertTitleInfo = userInfoService.getExpertTitleInfoById(id);
			rs.setData(tExpertTitleInfo);
			LOG.info("查找专家人才称号信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找专家人才称号信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyExpertTitleInfoById")
    @ResponseBody
    public ResultData getReadyExpertTitleInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TExpertTitleInfo> tExpertTitleInfo = userInfoService.getReadyExpertTitleInfoById(id);
            if(tExpertTitleInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找专家人才称号信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找专家人才称号信息失败！");
            e.printStackTrace();
        }
        return rs;
    }

	@RequestMapping("/getPageExpertTitleInfo")
	@ResponseBody
	public ResultData getPageExpertTitleInfo(Page<TExpertTitleInfo> page,@RequestBody TExpertTitleInfo tExpertTitleInfo) {
		ResultData rs = new ResultData();
		rs = checkErpNoIsNull(tExpertTitleInfo.getErpNo());
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageExpertTitleInfoByCondi(page,tExpertTitleInfo);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setMajorName(SysDictionaryUtil.getNameByValueForDefault("ProWorkTypes", p.getMajor()));
					p.setEmpTitleName(SysDictionaryUtil.getNameByValueForDefault("TalentTitle", p.getEmpTitle()));
					p.setLevelNameName(SysDictionaryUtil.getNameByValueForDefault("ExpertLevel", p.getLevelName()));
					p.setTypeName(SysDictionaryUtil.getNameByValueForDefault("ExpertCategory", p.getType()));
				});
			}
			rs.setData(page);
			LOG.info("查找专家人才称号信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找专家人才称号信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加学术成果
	 *
	 * @param tAcadeAchiveInfo
	 * @return
	 */
	@RequestMapping("/addAcadeAchiveInfo")
	@ResponseBody
	public ResultData addAcadeAchiveInfo(@RequestBody TAcadeAchiveInfo tAcadeAchiveInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tAcadeAchiveInfo.setToken(this.getToken(request));
			String message = userInfoService.addAcadeAchiveInfo(tAcadeAchiveInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else{
				rs.setData("学术成果添加成功！");
				LOG.info("学术成果添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("学术成果添加失败！");
			e.printStackTrace();
		}
		return rs;
	}


	@RequestMapping("/getAcadeAchiveInfoById")
	@ResponseBody
	public ResultData getAcadeAchiveInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			TAcadeAchiveInfoVo tAcadeAchiveInfoVo = userInfoService.getAcadeAchiveInfoById(id);
			rs.setData(tAcadeAchiveInfoVo);
			LOG.info("查找学术成果信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找学术成果信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyAcadeAchiveInfoById")
    @ResponseBody
    public ResultData getReadyAcadeAchiveInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TAcadeAchiveInfo> tAcadeAchiveInfo = userInfoService.getReadyAcadeAchiveInfoById(id);
            if(tAcadeAchiveInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找学术成果信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找学术成果信息失败！");
            e.printStackTrace();
        }
        return rs;
    }

	@RequestMapping("/getPageAcadeAchiveInfo")
	@ResponseBody
	public ResultData getPageAcadeAchiveInfo(Page<TAcadeAchiveInfoVo> page, @RequestBody TAcadeAchiveInfo tAcadeAchiveInfo) {
		ResultData rs = new ResultData();
		if(!tAcadeAchiveInfo.gettPartRankList().isEmpty()){
			rs = checkErpNoIsNull(tAcadeAchiveInfo.gettPartRankList().get(0).getErpNo());
		}else{
			rs.setSuccess(false);
			rs.setErrorMsg("ErpNo为空！");
		}
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageAcadeAchiveInfoByCondi(page,tAcadeAchiveInfo);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
					p.setAcadTypeName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoType", p.getAcadType()));
					p.setLevelName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJb", p.getLevel()));
				});
			}
			rs.setData(page);
			LOG.info("查找学术成果成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找学术成果失败！");
			e.printStackTrace();
		}
		return rs;
	}


	/**
	 * 添加制度标准
	 *
	 * @param tStandInfo
	 * @return
	 */
	@RequestMapping("/addStandInfo")
	@ResponseBody
	public ResultData addStandInfo(@RequestBody TStandInfo tStandInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tStandInfo.setToken(this.getToken(request));
			String message = userInfoService.addStandInfo(tStandInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else {
				rs.setData("制度标准添加成功！");
				LOG.info("制度标准添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("制度标准添加失败！");
			e.printStackTrace();
		}
		return rs;
	}


	@RequestMapping("/getStandInfoById")
	@ResponseBody
	public ResultData getStandInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			TStandInfoVo tStandInfoVo = userInfoService.getStandInfoById(id);
			rs.setData(tStandInfoVo);
			LOG.info("查找制度标准成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找制度标准失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyStandInfoById")
    @ResponseBody
    public ResultData getReadyStandInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TStandInfo> tStandInfo = userInfoService.getReadyStandInfoById(id);
            if(tStandInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找制度标准成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找制度标准失败！");
            e.printStackTrace();
        }
        return rs;
    }

	@RequestMapping("/getPageStandInfoInfo")
	@ResponseBody
	public ResultData getPageStandInfo(Page<TStandInfoVo> page, @RequestBody TStandInfo tStandInfo) {
		ResultData rs = new ResultData();
		if(!tStandInfo.gettPartRankList().isEmpty()){
			checkErpNoIsNull(tStandInfo.gettPartRankList().get(0).getErpNo());
		}else{
			rs.setSuccess(false);
			rs.setErrorMsg("ErpNo为空！");
		}
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageStandInfoByCondi(page,tStandInfo);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
					p.setTypeName(SysDictionaryUtil.getNameByValueForDefault("ZdbzType", p.getType()));
					p.setLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getLevel()));
				});
			}
			rs.setData(page);
			LOG.info("查找制度标准成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找制度标准失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加专利
	 *
	 * @param tPatentInfo
	 * @return
	 */
	@RequestMapping("/addPatentInfo")
	@ResponseBody
	public ResultData addPatentInfo(@RequestBody TPatentInfo tPatentInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tPatentInfo.setToken(this.getToken(request));
			String message = userInfoService.addPatentInfo(tPatentInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else {
				rs.setData("专利添加成功！");
				LOG.info("专利添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("专利添加失败！");
			e.printStackTrace();
		}
		return rs;
	}

	@RequestMapping("/getPatentInfoById")
	@ResponseBody
	public ResultData getPatentInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			TPatentInfoVo tPatentInfoVo = userInfoService.getPatentInfoById(id);
			rs.setData(tPatentInfoVo);
			LOG.info("查找专利成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找专利失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyPatentInfoById")
    @ResponseBody
    public ResultData getReadyPatentInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TPatentInfo> tPatentInfo = userInfoService.getReadyPatentInfoById(id);
            if(tPatentInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找专利成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找专利失败！");
            e.printStackTrace();
        }
        return rs;
    }

	@RequestMapping("/getPagePatentInfo")
	@ResponseBody
	public ResultData getPagePatentInfo(Page<TPatentInfoVo> page, @RequestBody TPatentInfo tPatentInfo) {
		ResultData rs = new ResultData();
		if(!tPatentInfo.gettPartRankList().isEmpty()){
			checkErpNoIsNull(tPatentInfo.gettPartRankList().get(0).getErpNo());
		}else{
			rs.setSuccess(false);
			rs.setErrorMsg("ErpNo为空！");
		}
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPagePatentInfoByCondi(page,tPatentInfo);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
					p.setPatentTypeName(SysDictionaryUtil.getNameByValueForDefault("PatentType", p.getPatentType()));
				});
			}
			rs.setData(page);
			LOG.info("查找专利信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找专利信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加技艺革新信息
	 *
	 * @param tTecInnovInfo
	 * @return
	 */
	@RequestMapping("/addTecInnovInfo")
	@ResponseBody
	public ResultData addTecInnovInfo(@RequestBody TTecInnovInfo tTecInnovInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tTecInnovInfo.setToken(this.getToken(request));
			String message = userInfoService.addTecInnovInfo(tTecInnovInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else {
				rs.setData("技艺革新信息添加成功！");
				LOG.info("技艺革新信息添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("技艺革新信息添加失败！");
			e.printStackTrace();
		}
		return rs;
	}

	@RequestMapping("/getTecInnovInfoById")
	@ResponseBody
	public ResultData getTecInnovInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			TTecInnovInfoVo tTecInnovInfoVo = userInfoService.getTecInnovInfoById(id);
			rs.setData(tTecInnovInfoVo);
			LOG.info("查找技艺革新信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找技艺革新信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyTecInnovInfoById")
    @ResponseBody
    public ResultData getReadyTecInnovInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TTecInnovInfo> tTecInnovInfo = userInfoService.getReadyTecInnovInfoById(id);
            if(tTecInnovInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找技艺革新信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找技艺革新信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


	@RequestMapping("/getPageTecInnovInfo")
	@ResponseBody
	public ResultData getPageTecInnovInfo(Page<TTecInnovInfoVo> page, @RequestBody TTecInnovInfo tTecInnovInfo) {
		ResultData rs = new ResultData();
		if(!tTecInnovInfo.gettPartRankList().isEmpty()){
			checkErpNoIsNull(tTecInnovInfo.gettPartRankList().get(0).getErpNo());
		}else{
			rs.setSuccess(false);
			rs.setErrorMsg("ErpNo为空！");
		}
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageTecInnovInfoByCondi(page,tTecInnovInfo);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
					p.setAwardLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getAwardLevel()));
					p.setAwardGradeName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcDj", p.getAwardGrade()));
				});
			}
			rs.setData(page);
			LOG.info("查找技艺革新信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找技艺革新信息失败！");
			e.printStackTrace();
		}
		return rs;
	}


	/**
	 * 添加竞赛考试
	 *
	 * @param tContestInfo
	 * @return
	 */
	@RequestMapping("/addContestInfo")
	@ResponseBody
	public ResultData addContestInfo(TContestInfo tContestInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tContestInfo.setToken(this.getToken(request));
			String message = userInfoService.addContestInfo(tContestInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else{
				rs.setData("竞赛考试添加成功！");
				LOG.info("竞赛考试添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("竞赛考试添加失败！");
			e.printStackTrace();
		}
		return rs;
	}


	@RequestMapping("/getContestInfoById")
	@ResponseBody
	public ResultData getContestInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			TContestInfo tContestInfo = userInfoService.getContestInfoById(id);
			rs.setData(tContestInfo);
			LOG.info("查找竞赛考试成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找竞赛考试失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyContestInfoById")
    @ResponseBody
    public ResultData getReadyContestInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TContestInfo> tContestInfo = userInfoService.getReadyContestInfoById(id);
            if(tContestInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找竞赛考试成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找竞赛考试失败！");
            e.printStackTrace();
        }
        return rs;
    }


	@RequestMapping("/getPageContestInfo")
	@ResponseBody
	public ResultData getPageContestInfo(Page<TContestInfo> page, @RequestBody TContestInfo tContestInfo) {
		ResultData rs = new ResultData();
		rs = checkErpNoIsNull(tContestInfo.getErpNo());
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageContestInfoByCondi(page,tContestInfo);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setAwardLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getAwardLevel()));
					p.setCompRankName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcDj", p.getCompRank()));
				});
			}
			rs.setData(page);
			LOG.info("查找竞赛考试成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找竞赛考试失败！");
			e.printStackTrace();
		}
		return rs;
	}


	/**
	 * 添加科技及管理、创新成果
	 *
	 * @param tTecManInnov
	 * @return
	 */
	@RequestMapping("/addTecManInnov")
	@ResponseBody
	public ResultData addTecManInnov(@RequestBody TTecManInnov tTecManInnov,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tTecManInnov.setToken(this.getToken(request));
			String message = userInfoService.addTecManInnov(tTecManInnov,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else {
				rs.setData("科技及管理、创新成果添加成功！");
				LOG.info("科技及管理、创新成果添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("科技及管理、创新成果添加失败！");
			e.printStackTrace();
		}
		return rs;
	}


	@RequestMapping("/getTecManInnovById")
	@ResponseBody
	public ResultData getTecManInnovById(String id) {
		ResultData rs = new ResultData();
		try {
			TTecManInnovVo tTecManInnov = userInfoService.getTecManInnovById(id);
			rs.setData(tTecManInnov);
			LOG.info("查找科技及管理、创新成果成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找科技及管理、创新成果失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyTecManInnovById")
    @ResponseBody
    public ResultData getReadyTecManInnovById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TTecManInnov> tTecManInnov = userInfoService.getReadyTecManInnovById(id);
            if(tTecManInnov.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找科技及管理、创新成果成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找科技及管理、创新成果失败！");
            e.printStackTrace();
        }
        return rs;
    }

	@RequestMapping("/getPageTecManInnov")
	@ResponseBody
	public ResultData getPageTecManInnov(Page<TTecManInnovVo> page, @RequestBody TTecManInnov tTecManInnov) {
		ResultData rs = new ResultData();
		if(!tTecManInnov.gettPartRankList().isEmpty()){
			checkErpNoIsNull(tTecManInnov.gettPartRankList().get(0).getErpNo());
		}else{
			rs.setSuccess(false);
			rs.setErrorMsg("ErpNo为空！");
		}
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageTecManInnovByCondi(page,tTecManInnov);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
					p.setAwardLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getAwardLevel()));
					p.setAwardGradeName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcDj", p.getAwardGrade()));
					p.setAchiTypeName(SysDictionaryUtil.getNameByValueForDefault("KjglAchiveType", p.getAchiType()));
				});
			}
			rs.setData(page);
			LOG.info("查找科技及管理、创新成果成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找科技及管理、创新成果失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加个人荣誉信息
	 *
	 * @param tHonorInfo
	 * @return
	 */
	@RequestMapping("/addHonorInfo")
	@ResponseBody
	public ResultData addHonorInfo(THonorInfo tHonorInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tHonorInfo.setToken(this.getToken(request));
			String message = userInfoService.addHonorInfo(tHonorInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else{
				rs.setData("个人荣誉信息添加成功！");
				LOG.info("个人荣誉信息添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("个人荣誉信息添加失败！");
			e.printStackTrace();
		}
		return rs;
	}

	@RequestMapping("/getHonorInfoById")
	@ResponseBody
	public ResultData getHonorInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			THonorInfo tHonorInfo = userInfoService.getHonorInfoById(id);
			rs.setData(tHonorInfo);
			LOG.info("查找个人荣誉信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找个人荣誉信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyHonorInfoById")
    @ResponseBody
    public ResultData getReadyHonorInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<THonorInfo> tHonorInfo = userInfoService.getReadyHonorInfoById(id);
            if(tHonorInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找个人荣誉信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找个人荣誉信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


	@RequestMapping("/getPageHonorInfo")
	@ResponseBody
	public ResultData getPageHonorInfo(Page<THonorInfo> page,@RequestBody  THonorInfo tHonorInfo) {
		ResultData rs = new ResultData();
		rs = checkErpNoIsNull(tHonorInfo.getErpNo());
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageHonorInfoByCondi(page,tHonorInfo);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setHonorLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getHonorLevel()));
					p.setHonorTypeName(SysDictionaryUtil.getNameByValueForDefault("RuYuLeiBie", p.getHonorType()));
				});
			}
			rs.setData(page);
			LOG.info("查找个人荣誉信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找个人荣誉信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加工作经历
	 *
	 * @param tWorkExpInfo
	 * @return
	 */
	@RequestMapping("/addWorkExpInfo")
	@ResponseBody
	public ResultData addWorkExpInfo(TWorkExpInfo tWorkExpInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tWorkExpInfo.setToken(this.getToken(request));
			String message = userInfoService.addWorkExpInfo(tWorkExpInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else{
				rs.setData("工作经历添加成功！");
				LOG.info("工作经历添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("工作经历添加失败！");
			e.printStackTrace();
		}
		return rs;
	}


	@RequestMapping("/getWorkExpInfoById")
	@ResponseBody
	public ResultData getWorkExpInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			TWorkExpInfo tWorkExpInfo = userInfoService.getWorkExpInfoById(id);
			rs.setData(tWorkExpInfo);
			LOG.info("查找工作经历成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找工作经历失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyWorkExpInfoById")
    @ResponseBody
    public ResultData getReadyWorkExpInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TWorkExpInfo> tWorkExpInfo = userInfoService.getReadyWorkExpInfoById(id);
            if(tWorkExpInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找工作经历成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找工作经历失败！");
            e.printStackTrace();
        }
        return rs;
    }

	@RequestMapping("/getPageWorkExp")
	@ResponseBody
	public ResultData getPageWorkExpInfo(Page<TWorkExpInfo> page, @RequestBody TWorkExpInfo tWorkExpInfo) {
		ResultData rs = new ResultData();
		rs = checkErpNoIsNull(tWorkExpInfo.getErpNo());
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageWorkExpInfoByCondi(page,tWorkExpInfo);
			if(!page.getResult().isEmpty()) {

				page.getResult().forEach(p -> {
					p.setPostTypeName(SysDictionaryUtil.getNameByValueForDefault("PostCategory", p.getPostType()));//绩效等级
					p.setRankName(SysDictionaryUtil.getNameByValueForDefault("DutyLevel", p.getRank()));//绩效等级
				});
			}
			rs.setData(page);
			LOG.info("查找工作经历成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找工作经历失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加项目、课题、成果
	 *
	 * @param
	 * @return
	 */
	@RequestMapping("/addProjAchieveInfo")
	@ResponseBody
	public ResultData addProjAchieveInfo(@RequestBody TProjAchieveInfo tProjAchieveInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tProjAchieveInfo.setToken(this.getToken(request));
			String message = userInfoService.addProjAchieveInfo(tProjAchieveInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else {
				rs.setData("项目课题成果添加成功！");
				LOG.info("项目课题成果添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("项目课题成果添加失败！");
			e.printStackTrace();
		}
		return rs;
	}


	@RequestMapping("/getProjAchieveInfoById")
	@ResponseBody
	public ResultData getProjAchieveInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			TProjAchieveInfoVo tProjAchieveInfoVo = userInfoService.getProjAchieveInfoById(id);
			rs.setData(tProjAchieveInfoVo);
			LOG.info("查找项目课题成果成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找项目课题成果失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyProjAchieveInfoById")
    @ResponseBody
    public ResultData getReadyProjAchieveInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TProjAchieveInfo> tProjAchieveInfoVo = userInfoService.getReadyProjAchieveInfoById(id);
            if(tProjAchieveInfoVo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找项目课题成果成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找项目课题成果失败！");
            e.printStackTrace();
        }
        return rs;
    }

	@RequestMapping("/getPageProjAchieveInfo")
	@ResponseBody
	public ResultData getPageProjAchieveInfo(Page<TProjAchieveInfoVo> page, @RequestBody TProjAchieveInfo tProjAchieveInfo) {
		ResultData rs = new ResultData();
		if(!tProjAchieveInfo.gettPartRankList().isEmpty()){
			checkErpNoIsNull(tProjAchieveInfo.gettPartRankList().get(0).getErpNo());
		}else{
			rs.setSuccess(false);
			rs.setErrorMsg("ErpNo为空！");
		}
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageProjAchieveInfoByCondi(page,tProjAchieveInfo);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XiangMuKeTiJS", p.getRole()));
					p.setProjLevelName(SysDictionaryUtil.getNameByValueForDefault("StandardLevel", p.getProjLevel()));
				});
			}
			rs.setData(page);
			LOG.info("查找项目课题成果成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找项目课题成果失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加继续教育经历、培训经历、授课经历
	 *
	 * @param tContiStudyInfo
	 * @return
	 */
	@RequestMapping("/addContiStudyInfo")
	@ResponseBody
	public ResultData addContiStudyInfo(TContiStudyInfo tContiStudyInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tContiStudyInfo.setToken(this.getToken(request));
			String message = userInfoService.addContiStudyInfo(tContiStudyInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else{
				rs.setData("培训及授课经历添加成功！");
				LOG.info("培训及授课经历添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("培训及授课经历添加失败！");
			e.printStackTrace();
		}
		return rs;
	}


	@RequestMapping("/getContiStudyInfoById")
	@ResponseBody
	public ResultData getContiStudyInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			TContiStudyInfo tContiStudyInfo = userInfoService.getContiStudyInfoById(id);
			rs.setData(tContiStudyInfo);
			LOG.info("查询培训及授课经历成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查询培训及授课经历失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyContiStudyInfoById")
    @ResponseBody
    public ResultData getReadyContiStudyInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TContiStudyInfo> tContiStudyInfo = userInfoService.getReadyContiStudyInfoById(id);
            if(tContiStudyInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查询培训及授课经历成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查询培训及授课经历失败！");
            e.printStackTrace();
        }
        return rs;
    }

	@RequestMapping("/getPageContiStudyInfo")
	@ResponseBody
	public ResultData getPageContiStudyInfo(Page<TContiStudyInfo> page, @RequestBody TContiStudyInfo tContiStudyInfo) {
		ResultData rs = new ResultData();
    	rs = checkErpNoIsNull(tContiStudyInfo.getErpNo());
		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageContiStudyInfoByCondi(page,tContiStudyInfo);
			if(!page.getResult().isEmpty()) {
				page.getResult().forEach(p -> {
					p.setTypeName(SysDictionaryUtil.getNameByValueForDefault("PeixunshoukeType", p.getType()));//绩效等级
				});
			}
			rs.setData(page);
			LOG.info("查询培训及授课经历成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查询培训及授课经历失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加导师带徒
	 *
	 * @param
	 * @return
	 */
	@RequestMapping("/addSdtTutorPrentInfo")
	@ResponseBody
	public ResultData addSdtTutorPrentInfo(@RequestBody TSdtTutorPrentInfo tSdtTutorPrentInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tSdtTutorPrentInfo.setToken(this.getToken(request));
			String message = userInfoService.addSdtTutorPrentInfo(tSdtTutorPrentInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else{
				rs.setData("导师带徒添加成功！");
				LOG.info("导师带徒添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("导师带徒添加失败！");
			e.printStackTrace();
		}
		return rs;
	}


	@RequestMapping("/getSdtTutorPrentInfoById")
	@ResponseBody
	public ResultData getSdtTutorPrentInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			TSdtTutorPrentInfo tSdtTutorPrentInfo = userInfoService.getSdtTutorPrentInfoById(id);
			rs.setData(tSdtTutorPrentInfo);
			LOG.info("查找导师带徒添加成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找导师带徒添加失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取当前数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadySdtTutorPrentInfoById")
    @ResponseBody
    public ResultData getReadySdtTutorPrentInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TSdtTutorPrentInfo> tSdtTutorPrentInfo = userInfoService.getReadySdtTutorPrentInfoById(id);
            if(tSdtTutorPrentInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找导师带徒添加成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找导师带徒添加失败！");
            e.printStackTrace();
        }
        return rs;
    }

	@RequestMapping("/getPageSdtTutorPrentInfo")
	@ResponseBody
	public ResultData getPageSdtTutorPrentInfo(Page<TSdtTutorPrentInfo> page,@RequestBody  TSdtTutorPrentInfo tSdtTutorPrentInfo) {

		ResultData rs = new ResultData();
		rs = checkErpNoIsNull(tSdtTutorPrentInfo.getErpNo());

		if(rs.isSuccess()!=true){
			return rs;
		}
		try {
			userInfoService.findPageSdtTutorPrentInfoByCondi(page,tSdtTutorPrentInfo);

			rs.setData(page);
			LOG.info("查找导师带徒信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找导师带徒信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 *
	 * @param mouldInfo
	 * @param page
	 * @param inTimeBeginStr
	 * @param inTimeEndStr
	 * @param ids
	 * @return
	 */
//	@RequestMapping("/getMouldInfoList")
//	@ResponseBody
//	public ResultData getMouldInfoList(TMouldInfo mouldInfo, Page<TMouldInfo> page, String inTimeBeginStr,
//			String inTimeEndStr, String ids) {
//		ResultData result = new ResultData();
//		try {
//			userInfoService.getMouldInfoPageByCondition(page, mouldInfo, inTimeBeginStr, inTimeEndStr, ids);
//			result.setData(page);
//		} catch (Exception e) {
//			result.setErrorMsg("模糊查询信息异常");
//			result.setSuccess(false);
//			LOG.error("模糊查询信息异常", e);
//		}
//		return result;
//	}

	/**
	 * 查询个人资料概览种类信息
	 * @param tMouldInfo
	 * @return
	 */
	@RequestMapping("/getMouldInfoList")
	@ResponseBody
	public ResultData getMouldInfoList(TMouldInfo tMouldInfo) {
		ResultData rs = new ResultData();
		try {
			List<TMouldInfo> list=userInfoService.getMouldInfoList(tMouldInfo);
			rs.setData(list);
			LOG.info("查询个人分类信息成功！");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查询个人分类信息失败！");
			e.printStackTrace();
		}
		return rs;
	}


	/**
	 * 查看每类信息详情
	 * @param detail
	 * @param page
	 * @return
	 */
	@RequestMapping("/getEachTypeDetailList")
	@ResponseBody
	public ResultData getEachTypeDetailList(EachTypeDetailVo detail,Page<EachTypeDetailVo> page) {
		ResultData rs = new ResultData();
		try {
			/*
			Class dtClass = Class.forName("cn.com.headfree.entity.TEmpBaseInfo");
			Object dtObj = dtClass.newInstance();

			userInfoService.getEachTypeDetailList(detail,page);
			if(detail.getTabName().equals("t_emp_base_info")){

				if(page.getResult().size()>0){
					org.springframework.beans.BeanUtils.copyProperties(page.getResult().get(0),dtObj);
				}

			}*/
			//用于测试
			detail.setErpNo("1");
			userInfoService.getEachTypeDetailList(detail,page);
			rs.setData(page);
			LOG.info("查询个人信息成功！");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查询个人信息失败！");
			e.printStackTrace();
		}
		return rs;
	}



    /**
     * 获取字典信息
     * @param
     * @return
     */
    @RequestMapping("/getSysDictionaryByValue")
    @ResponseBody
    public ResultData getSysDictionaryByValue(String value) {
        ResultData result = new ResultData();
        try {
            List<SysDictionaryInfoVo> sysDictionaryInfoVos = userInfoService.getAttendanceUserTypeByValue(value);
            result.setData(sysDictionaryInfoVos);
        } catch (Exception e)
        {
            result.setErrorMsg("数据字典获取成功！");
            result.setSuccess(false);
            LOG.error("数据字典获取异常", e);
        }
        return result;
    }


    private ResultData checkErpNoIsNull(String erpNo){
		ResultData result = new ResultData();
		if(StringUtils.isEmpty(erpNo)){
			result.setSuccess(false);
			result.setErrorMsg("ErpNo或记录ID参数为空");
		}
		return result;
	}

    /**
	 * 添加挂职轮岗信息
	 * @author yangwang
	 * @param tRotationInfo
	 * @param request
	 * @return ResultData
	 */
	@RequestMapping("/addRotationInfo")
	@ResponseBody
	public ResultData addRotationInfo(@RequestBody TRotationInfo tRotationInfo,HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if(StringUtil.isNullOrEmpty(user.getRemark())){
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			//add by yangwang 20200803 添加token传参
//			tRotationInfo.setToken(this.getToken(request));
			String message = userInfoService.addRotationInfo(tRotationInfo,user);
			if(StringUtils.isNotBlank(message)){
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			}else{
				rs.setData("挂职轮岗信息添加成功！");
				LOG.info("挂职轮岗信息添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("挂职轮岗信息添加失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 获取挂职轮岗分页信息
	 * @author yangwang
	 * @param page
	 * @param tRotationInfo
	 * @return ResultData
	 */
	@RequestMapping("/getPageRotationInfo")
	@ResponseBody
	public ResultData getPageRotationInfo(Page<TRotationInfo> page,@RequestBody TRotationInfo tRotationInfo) {
		ResultData rs = new ResultData();
		try {
			userInfoService.findPageRotationInfoByCondi(page,tRotationInfo);
			rs.setData(page);
			LOG.info("查找挂职轮岗信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找挂职轮岗信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 根据id获取挂职轮岗信息
	 * @author yangwang
	 * @return ResultData
	 */
	@RequestMapping("/getRotationInfoById")
	@ResponseBody
	public ResultData getRotationInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			rs.setData(userInfoService.getRotationInfoById(id));
			LOG.info("查找挂职轮岗信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找挂职轮岗信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
     * 根据id获取挂职轮岗数据是否存在待审核的数据
     * @param id
     * @return
     */
    @RequestMapping("/getReadyRotationInfoById")
    @ResponseBody
    public ResultData getReadyRotationInfoById(String id) {
        ResultData rs = new ResultData();
        try {
            List<TRotationInfo> tRotationInfo = userInfoService.getReadyRotationInfoById(id);
            if(tRotationInfo.size()>0){
                rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
            }else{
                rs.setSuccess(true);
            }
            LOG.info("查找挂职轮岗信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找挂职轮岗信息失败！");
            e.printStackTrace();
        }
        return rs;
    }


    /**
	 * 根据人资编号获取个人岗位方向选项
	 *
	 * @param erpNo
	 * @return
	 */
	@RequestMapping("/getFuturePostByErpNo")
	@ResponseBody
	public ResultData getFuturePostByErpNo(String erpNo) {
		ResultData rs = new ResultData();
		try {
			FuturePostVo futurePost = userInfoService.getFuturePostByErpNo(erpNo);
			List<String> list = new ArrayList<String>();
			if (futurePost != null) {
				if (futurePost.getFuturePost().contains("、")) {
					String[] futurePosts = futurePost.getFuturePost().split("、");
					for (String v : futurePosts) {
						list.add(v);
					}
				} else {
					list.add(futurePost.getFuturePost());
				}
			}
			rs.setData(list);
			LOG.info("根据人资编号获取个人岗位方向选项成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("根据人资编号获取个人岗位方向选项失败！");
			LOG.error("根据人资编号获取个人岗位方向选项失败！", e);
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加员工成长计划
	 *
	 * @param tGrowthPlan
	 * @param request
	 * @return
	 */
	@RequestMapping("/addGrowthPlan")
	@ResponseBody
	public ResultData addGrowthPlan(@RequestBody TGrowthPlan tGrowthPlan, HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if (StringUtil.isNullOrEmpty(user.getRemark())) {
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			// 添加token传参
//			tGrowthPlan.setToken(this.getToken(request));
			List<TDeptEmpRela> depts=deptErpRelaService.getDeptInfoByErpNo(tGrowthPlan.getErpNo());
			if(depts!=null&&depts.size()>0) {
				tGrowthPlan.setDeptId(depts.get(0).getDeptId());
			}
			tGrowthPlan.setDeptName(GetFullDeptByErpNoUtil.getFullDept(tGrowthPlan.getErpNo()));//获取部门全路径
			userInfoService.addGrowthPlan(tGrowthPlan, user);
			rs.setData("员工成长计划添加成功！");
			LOG.info("员工成长计划添加成功！");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("员工成长计划添加失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 分页查找所有员工成长计划列表
	 *
	 * @param page
	 * @param tGrowthPlan
	 * @return
	 */
	@RequestMapping("/getPageGrowthPlan")
	@ResponseBody
	public ResultData getPageGrowthPlan(Page<TGrowthPlan> page, @RequestBody TGrowthPlan tGrowthPlan) {
		ResultData rs = new ResultData();
		try {
			//去除参数中的前后空格
			SaiUtil.beanAttributeValueTrim(tGrowthPlan);
			userInfoService.findPageGrowthPlanByCondi(page, tGrowthPlan);
			rs.setData(page);
			LOG.info("查找员工成长计划成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找员工成长计划失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 分页查找个人员工成长计划列表
	 *
	 * @param page
	 * @param erpNo
	 * @return
	 */
	@RequestMapping("/getPersonalPageGrowthPlanByErpNo")
	@ResponseBody
	public ResultData getPersonalPageGrowthPlanByErpNo(Page<TGrowthPlan> page, String erpNo) {
		ResultData rs = new ResultData();
		try {
			userInfoService.getPersonalPageGrowthPlanByErpNo(page, erpNo);
			rs.setData(page);
			LOG.info("查找个人员工成长计划成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找个人员工成长计划失败！");
			e.printStackTrace();
		}
		return rs;
	}

    /**
	 * 根据Id查找员工成长计划详情
	 *
	 * @param id
	 * @return
	 */
	@RequestMapping("/getGrowthPlanById")
	@ResponseBody
	public ResultData getGrowthPlanById(String id) {
		ResultData rs = new ResultData();
		try {
			rs.setData(userInfoService.getGrowthPlanById(id));
			LOG.info("查找员工成长计划成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找员工成长计划失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 编辑员工成长计划
	 *
	 * @param tGrowthPlan
	 * @param request
	 * @return
	 */
	@RequestMapping("/updateGrowthPlan")
	@ResponseBody
	public ResultData updateGrowthPlan(@RequestBody TGrowthPlan tGrowthPlan, HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if (StringUtil.isNullOrEmpty(user.getRemark())) {
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			// 添加token传参
//   			tGrowthPlan.setToken(this.getToken(request));
			List<TDeptEmpRela> depts=deptErpRelaService.getDeptInfoByErpNo(tGrowthPlan.getErpNo());
			if(depts!=null&&depts.size()>0) {
				tGrowthPlan.setDeptId(depts.get(0).getDeptId());
//				tGrowthPlan.setDeptName(depts.get(0).getDeptName());
			}
			tGrowthPlan.setDeptName(GetFullDeptByErpNoUtil.getFullDept(tGrowthPlan.getErpNo()));//获取部门全路径
			userInfoService.updateGrowthPlan(tGrowthPlan, user);
			rs.setData("员工成长计划更新成功！");
			LOG.info("员工成长计划更新成功！");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("员工成长计划更新失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加人员流动信息
	 *
	 * @param tEmployeeMobility
	 * @param request
	 * @return
	 */
	@RequestMapping("/addEmployeeMobility")
	@ResponseBody
	public ResultData addEmployeeMobility(@RequestBody TEmployeeMobility tEmployeeMobility, HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if (StringUtil.isNullOrEmpty(user.getRemark())) {
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			// 添加token传参
//			tEmployeeMobility.setToken(this.getToken(request));
			String message =userInfoService.addEmployeeMobility(tEmployeeMobility, user);
			if (StringUtils.isNotBlank(message)) {
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			} else {
				rs.setData("人员流动信息添加成功！");
				LOG.info("人员流动信息添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("人员流动信息添加失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 分页查找所有人员流动列表
	 *
	 * @param page
	 * @param tEmployeeMobility
	 * @return
	 */
	@RequestMapping("/getPageEmployeeMobility")
	@ResponseBody
	public ResultData getPageEmployeeMobility(Page<TEmployeeMobility> page, @RequestBody TEmployeeMobility tEmployeeMobility) {
		ResultData rs = new ResultData();
		try {
			//去除参数中的前后空格
			SaiUtil.beanAttributeValueTrim(tEmployeeMobility);
			userInfoService.findPageEmployeeMobilityByCondi(page, tEmployeeMobility);
			rs.setData(page);
			LOG.info("查找人员流动列表成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找人员流动列表失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 分页查找个人人员流动列表
	 *
	 * @param page
	 * @param erpNo
	 * @return
	 */
	@RequestMapping("/getPersonalPageEmployeeMobilityByErpNo")
	@ResponseBody
	public ResultData getPersonalPageEmployeeMobilityByErpNo(Page<TEmployeeMobility> page, String erpNo) {
		ResultData rs = new ResultData();
		try {
			userInfoService.getPersonalPageEmployeeMobilityByErpNo(page, erpNo);
			rs.setData(page);
			LOG.info("查找个人人员流动列表成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找个人人员流动列表成功！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 根据Id查找个人人员流动信息详情
	 *
	 * @param id
	 * @return
	 */
	@RequestMapping("/getEmployeeMobilityById")
	@ResponseBody
	public ResultData getEmployeeMobilityById(String id) {
		ResultData rs = new ResultData();
		try {
			rs.setData(userInfoService.getEmployeeMobilityById(id));
			LOG.info("查找个人人员流动信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找个人人员流动信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 编辑个人人员流动信息
	 *
	 * @param tEmployeeMobility
	 * @param request
	 * @return
	 */
	@RequestMapping("/updateEmployeeMobility")
	@ResponseBody
	public ResultData updateEmployeeMobility(@RequestBody TEmployeeMobility tEmployeeMobility, HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if (StringUtil.isNullOrEmpty(user.getRemark())) {
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			// 添加token传参
//   			tGrowthPlan.setToken(this.getToken(request));
			userInfoService.updateEmployeeMobility(tEmployeeMobility, user);
			rs.setData("人员流动信息更新成功！");
			LOG.info("人员流动信息更新成功！");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("人员流动信息更新失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 根据id获取人员流动信息是否存在待审核的数据
	 *
	 * @param id
	 * @return
	 */
	@RequestMapping("/getReadyEmployeeMobilityById")
	@ResponseBody
	public ResultData getReadyEmployeeMobilityById(String id) {
		ResultData rs = new ResultData();
		try {
			List<TEmployeeMobility> employeeMobilitys = userInfoService.getReadyEmployeeMobilityById(id);
			if (employeeMobilitys.size() > 0) {
				rs.setSuccess(false);
				rs.setErrorMsg("当前存在待审核数据");
				return rs;
			}
			List<TSalaryBusinessBind> salaryBusinessBinds =  userInfoService.getEmployeeMobilitySalaryById(id);
			if(!CollectionUtils.isEmpty(salaryBusinessBinds)){
				rs.setSuccess(false);
				rs.setErrorMsg("当前数据已用于薪档申报，不可修改！");
				return rs;
			}
			LOG.info("查找人员流动信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找人员流动信息失败！");
			e.printStackTrace();
		}
		return rs;
	}


	/**
	 * 分页查找所有技术标准列表
	 *
	 * @param page
	 * @param tecStandardInfo
	 * @return
	 */
	@RequestMapping("/getPageTecStandardInfo")
	@ResponseBody
	public ResultData getPageTecStandardInfo(Page<TTecStandardInfo> page, @RequestBody TTecStandardInfo tecStandardInfo) {
		ResultData rs = new ResultData();
		try {
			//去除参数中的前后空格
			SaiUtil.beanAttributeValueTrim(tecStandardInfo);
			userInfoService.findPageTecStandardInfoByCondi(page, tecStandardInfo);
			rs.setData(page);
			LOG.info("查找人员流动列表成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找人员流动列表失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 添加技术标准
	 *
	 * @param tecStandardInfo
	 * @return
	 */
	@RequestMapping("/addTecStandardInfo")
	@ResponseBody
	public ResultData addTecStandardInfo(@RequestBody TTecStandardInfo tecStandardInfo, HttpServletRequest request) {
		ResultData rs = new ResultData();
		try {
			User user = this.getLoginUserInfo(request);
			if (StringUtil.isNullOrEmpty(user.getRemark())) {
				rs.setSuccess(false);
				rs.setErrorMsg("获取当前登录人角色失败，请重新登录");
				return rs;
			}
			// add by yangwang 20200803 添加token传参
//			tecStandardInfo.setToken(this.getToken(request));
			String message = userInfoService.addTecStandardInfo(tecStandardInfo, user);
			if (StringUtils.isNotBlank(message)) {
				rs.setSuccess(false);
				rs.setErrorMsg(message);
			} else {
				rs.setData("技术标准添加成功！");
				LOG.info("技术标准添加成功！");
			}
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("技术标准添加失败！");
			e.printStackTrace();
		}
		return rs;
	}

	/**
	 * 根据Id查找技术标准信息详情
	 *
	 * @param id
	 * @return
	 */
	@RequestMapping("/getTecStandardInfoById")
	@ResponseBody
	public ResultData getTecStandardInfoById(String id) {
		ResultData rs = new ResultData();
		try {
			rs.setData(userInfoService.getTecStandardInfoById(id));
			LOG.info("查找技术标准信息成功");
		} catch (Exception e) {
			rs.setSuccess(false);
			rs.setErrorMsg("查找技术标准信息失败！");
			e.printStackTrace();
		}
		return rs;
	}

}
